home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / SchoolStat1.0.8 / SchoolStat™ / SchoolStat™.rsrc / TEXT_1260_V11. Commands.txt < prev    next >
Text File  |  1994-01-30  |  17KB  |  127 lines

  1. ViewIt Commands
  2.   ViewIt commands are executed via the FaceIt dispatching procedure found in the file "FaceProcXY" (or in some other form compatible with your programming environment):
  3.   FaceIt(nil,[command],a,b,c,d);   {Pascal}
  4.   FaceIt(0L,[command],a,b,c,d);    /* C */
  5.   call FaceIt(0,[command],a,b,c,d) !Fortran
  6. where parameters a, b, c, and d are 4-byte integers, and where other record elements from the global fRec or other records may be used with particular commands.
  7.   Each ViewIt command name, its equivalent number, the parameters and record elements used by the command, and a complete description of the command are presented below.  Command names can be used in place of the numbers in calls to the FaceIt dispatching procedure since they are declared as constants in the file "FaceStorXY" (or in some other way compatible with your programming environment).
  8.  
  9. Name  Number  Parameters & Variables used
  10. NewWnd -1201  a,b,c,d,wWindow
  11. Opens a new ViewIt window according to parameters passed:
  12.     a = FWND resource ID (use -ID to keep window hidden)
  13.     b = initial window modality  (see "Windows")
  14.       0 = modal
  15.       1 = modeless
  16.     c = 0 or byte size of linked record (see "Data Links")
  17.     d = 0 or address of linked record (see "Data Links")
  18. and where wWindow returns with the WindowPtr (or nil if the window was not opened).  Note that if the FWND is not found, then ViewIt displays an alert and gives you the option of adding the FWND to the current res file at that time.  
  19.  
  20. EndWnd -1202 a,wiHit,wvHit,wcHit,wEvent
  21. Disposes of the ViewIt window defined by parameter a, where a can be either an FWND ID, a WindowPtr, zero to close the top modal or active modeless window, or -1 to close all open modal ViewIt windows.
  22.   If the ViewIt window being closed is a modal window that lies below other modal windows, then all windows above it will also be closed (or made modeless again if they were modeless windows made modal by MdlWnd).
  23.   If the window being closed is modal, then the variables wiHit, wvHit, wcHit, wClick, and wEvent are also restored to the values that they held when the window was opened with NewWnd (or made modal with MdlWnd).  This feature facilitates the nesting of modal event loops designed around use of the "Hit" variables, but could be confusing in other cases if you forget that EndWnd changes these variables.
  24.  
  25. MdlWnd -1203  a,b
  26. Passes control to ViewIt to perform event handling for, or modify the current mode of, the window designated by a, where a can be either the associated FWND ID, the window's WindowPtr, or zero to designate the top modal or active modeless window.  Parameter b designates the operation:
  27.     1 = convert modal window back to modeless
  28.     0 = pass control to ViewIt for modal event handling
  29.   -1 = pass control but return w/o processing events
  30.   -2 = pass control and return after processing events
  31. The latter modal operations (b = 0, -1, or -2) can be applied to both modal and modeless windows.  The window is always brought to the front and made visible, and modeless windows are made modal until MdlWnd is called again with b = 1.  MdlWnd is usually found between calls to NewWnd and EndWnd.  See the "Windows" topic for more info.
  32.   If MdlWnd is used to convert a modal window back to its previous modeless state (b = 1), then the variables wiHit, wvHit, wcHit, wClick, & wEvent are also restored to the values that they held when the window was made modal.  As with EndWnd, this facilitates the nesting of modal event loops designed around use of the "Hit" variables, but could be confusing in other cases if you forget that MdlWnd changes these variables.
  33.  
  34. SizWnd -1204  a,b,c,d
  35. Resizes the ViewIt window designated by a, where a can be either the associated FWND ID, the window's WindowPtr, or zero to designate the top modal or active modeless window.  Parameters b and c are the window's new horizontal and vertical dimensions, respectively.  The size of the window may be limited by controls that are attached to the bottom or right sides of the window.  For modeless windows, d can be optionally used to designate the amount of updating to be done at the time SizWnd is called, where its meaning is the same as that defined for FaceIt's DoUpdt2 command.
  36. NOTE:  Do not attempt to use the toolbox call SizeWindow in place of SizWnd since the former will not readjust the size of controls that are attached to the window's sides.
  37.  
  38. MovWnd -1205  a,b,c,d
  39. Moves the ViewIt window designated by a, where a can be either the associated FWND ID, the window's WindowPtr, or zero to designate the top modal or active modeless window.  Parameters b, c, & d are the same as those supported by UtilIt's MovRec command.
  40.  
  41. ShoWnd -1206  a,d
  42. HidWnd -1207  a,d
  43. Hides (HidWnd) or shows & selects (ShoWnd) the ViewIt window designated by a, where a can be either the FWND ID, the window's WindowPtr, or zero to designate the top modal or active modeless window.  For modeless windows, parameter d can be optionally used to designate the amount of updating to be done at the time HidWnd or ShoWnd is called, where its meaning is the same as that defined for FaceIt's DoUpdt2 command.
  44. NOTE:  Do not attempt to use the toolbox calls HideWindow, ShowWindow, or SelectWindow in place of Hid/ShoWnd since the former will not maintain proper window layering.
  45.  
  46. GetWnd -1209  a,b,c,d,wWindow-cScript
  47. GetCtl -1211  a,b,c,d,cControl-cScript
  48. GetWVC -1208  a,b,c,d,wWindow-cScript
  49. ShoCtl -1212  a,b,c,d,cControl-cScript
  50. ActCtl -1219  a,b,c,d,cControl-cScript
  51. SelCtl -1220  a,b,c,d,cControl-cScript
  52. GetVal -1213  a,b,c,d,cControl-cScript
  53. SetVal -1214  a,b,c,d,cControl-cScript
  54. These commands all make the same use of parameters a, b, c, and d to locate a window and control.  a & b are used to designate the window (4 options):
  55.        a = 0, b = ControlHandle (control's "owner" is used)
  56.   or  a = 0, b = 0 = top modal or active modeless window
  57.   or  a = FWND ID, b = nth such window (0 or 1 = topmost)
  58.   or  a = WindowPtr, b = 0
  59. and c & d designate a control in that window (4 options):
  60.        c = view number, d = control number in that view
  61.   or  c = 0, d = item number (the dth control in window)
  62.   or  c = 0, d = ControlHandle (a & b are ignored)
  63.   or  c = 0, d = 0 refers to all controls (GetVal, SetVal)
  64.   or  c = 0, d = 0 = skip getting control info (GetWnd)
  65.   or  c = 0, d = 0 = get FWND-type handle (GetWVC)
  66. If d is a ControlHandle, then a, b, and c are ignored since the control record itself specifies the owning window.  If a window or control cannot be found, then the corresponding wWindow or cControl variable returns zero (nil).
  67.   GetCtl updates the contents of the global fRec record with information about the specified control.  This information is copied from relocatable control records into the fRec variables cControl (the ControlHandle) to cScript. (Note that the cTitle and cScript strings are returned as Pascal strings, but can, if necessary, be converted to other string types using UtilIt's CnvStr command.)
  68.   GetWnd is identical to GetCtl except that it also returns information about the ViewIt window in the fRec variables wWindow (the WindowPtr) to wiCount.
  69.   GetWVC calls GetWnd (if c & d = 0) or GetCtl (if c or d ‚↠0), and then converts the specified window, view, or control into the corresponding FWND, FVEW, or FCTL-type relocatable block, returning the block's handle in uResult.  If uResult is zero (nil), then either the control, view, or window could not be found, or there was not enough memory to create the block.
  70.   An FWND handle returned by GetWVC is the handle to the FWND resource associated with the window.  If you wish to save this updated FWND to disk as a means of saving window settings, simply pass the FWND handle to the toolbox calls "ChangedResource" followed by "WriteResource".
  71.   An FVEW or FCTL handle returned by GetWVC is not a resource, and you are responsible for disposing of the block when finished with it (using "DisposHandle").  One use of this form of GetWVC is in the cloning of existing controls or views.  In this case GetWVC is used to create an FVEW- or FCTL-type block, and the block's handle is then passed to AddVew or AddCtl to add one or more copies of the view or control to the window.
  72.   ShoCtl and ActCtl are just convenient commands that take the place of calling GetCtl followed by a toolbox call that gets passed cControl.  ShoCtl calls ShowControl to show the control if the view or control number is positive, and HideControl if the number is negative:
  73.  FaceIt(nil,ShoCtl,0,0,-1,0); {hide first view}
  74.  FaceIt(nil,ShoCtl,0,0,1,-6); {hide 6th control}
  75. ActCtl calls HiliteControl to either activate the control if the view or control number is positive, or inactivate it if the number is negative.
  76.   SelCtl selects the designated control and, if necessary, scrolls it into view.  The control must be editable, visible, active, and within the active modeless window or topmost modal window.  Calling SelCtl is equivalent to tabbing to or clicking within an editable control to select it, and results in updating the vSelectCtl, vSelectRec, and vSelectID variables in fRec.
  77.   GetVal is used to update a program's linked data record with values from the window's controls, and SetVal is used to update the window's controls with values from the linked data record.  When used to get or set values for one control, these commands also result in updating the fRec variables cControl to cScript.  See "Data Links" for further info.
  78.   WARNING:  Do not assume that the content of any "u", "w", or "c" prefixed fRec variables is preserved across calls to the Control Manager or the FaceIt dispatching procedure.  Values that might need to be used again, such as a cControl ControlHandle, should be saved in program variables.
  79.  
  80. AddVew -1200  a,b,c,d
  81. AddCtl -1216  a,b,c,d
  82. Uses the FVEW (AddVew) or FCTL (AddCtl) type block designated by parameter a to add b copies of a new view or control, within the window or above the control designated by c, at a screen position offset by d pixels:
  83.     a = FVEW (AddVew) or FCTL (AddCtl) resource ID
  84.   or  a = FVEW or FCTL block handle returned by GetWVC
  85.     b = number of new views or controls to create (0 = 1)
  86.       (use -b to indicate that new objects should be hidden)
  87.     c = object above/within which new object is to be placed
  88.       0 = top window (AddVew) and top view (AddCtl)
  89.       other = FWND ID, WindowPtr, or ControlHandle
  90.     d = screen offset from top, left of object designated by c
  91.       (hi word = pixels across, lo word = pixels down)
  92. If successful, uResult returns with the ControlHandle of the new view or control, otherwise it is set to zero (nil).  The following call, for example, would use FCTL 1010 to add one new control to top, left of top view in top window,
  93.  FaceIt(nil,AddCtl,1010,0,0,0);
  94. and return the new control's ControlHandle in uResult.  Calling AddVew or AddCtl has the same effect as using the standard menu item "Paste" when in ViewIt's editing mode.
  95.   When working with a large number of potential views in a window, AddVew should be considered as an alternative to hiding/showing views (i.e. DisposeControl/AddVew would be used to show the next view instead of Hide/ShowControl).  AddVew has the disadvantage of being a bit slower than a simple ShowControl, but does not require that all of the views be initialized when the window is first opened.
  96.   RESOURCE NOTE:  To create a new FVEW or FCTL resource to be later used with AddVew or AddCtl, simply copy the corresponding view or control when in editing mode and then use ResEdit to paste it into a resource file.
  97.  
  98. LnkCtl -1210  a,b,c,d
  99. Establishes link used by GetVal/SetVal between program variable and control value (see "Data Links" topic) where, 
  100.     a = ControlHandle (typically obtained from GetCtl)
  101.     b = memory address of program variable
  102.       (use b = 0 to "unlink" a control)
  103.     c = data type of program variable
  104.     d = digits (hi word) and number format (lo word)
  105.       (0 = general format, 4 fig.s, & decimal 0s removed)
  106.       (use d = -1 to preserve current digits/format)
  107. For example, LnkCtl could be used to link an editable text control at v1c4 to an integer variable "i" by calling,
  108.  FaceIt(nil,GetCtl,0,0,1,4); {view 1, control 4}
  109.  f := 2 + (3 * 65536); {fixed point, 3 decimals}
  110.  FaceIt(nil,LnkCtl,ord(cControl),ord(@i),2,f);
  111. where "@i" is the memory address of variable "i", "2" is the data type of a 2-byte integer, "f" is the combination of digits and format numbers, and "ord" is Pascal's way of converting the ControlHandle and address to long integers.
  112.   LnkCtl is particularly useful in cases where variables to be linked are not located within a single record, or when links need to be established with controls that have been dynamically added to a window (using AddCtl).  Also note that LnkCtl can be used in combination with the linking of an entire record to a ViewIt window (see "Data Links"), and that it is not necessary to "unlink" a control (b = 0) before linking it to a new variable.
  113.   TECHNICAL NOTE:  Calling LnkCtl results in resetting the control's private ccDataPtr, ccDataType, ccDataDigits, and ccDataFormat variables.  It also resets ccDataOffset to -1 to prevent the control from being later linked to a program record.  The alternative approach of setting the control's data linking info in ViewIt's Control dialog, and then passing a record address when calling NewWnd, is simply another way of getting the control's private ccDataPtr, ccDataType, ccDataDigits, and ccDataFormat set, which are the variables used by ViewIt when executing GetVal and SetVal.
  114.  
  115. OvrCtl -1215  a,b
  116. Resets the override procedure for the designated control, where a is the control's ControlHandle and b is a main program procedure.  To deinstall an override procedure, simply pass 0 (the default value) in parameter b.  This command is equivalent to setting the variable "ccOverride" in the cInfo supplemental control record, but is convenient for programmers who do not have direct access to this record.  See the "Override" topic for further details.
  117.  
  118. DrwCtl -1217  a,b
  119. Redraws the ViewIt control whose ControlHandle is given by parameter a.  Use b = 0 to redraw the entire control (same as toolbox call Draw1Control), or b = 2 to only redraw the visible content area of the control.  Do not use DrwCtl in place of toolbox calls SetCtlValue or HiliteControl since the latter perform additional operations which are necessary when changing the control's value or hilite state.
  120. NOTE: DrwCtl works best with controls that have solid bodies (are not transparent) since it does not first erase the control area before drawing.  For transparent controls (such as transparent static text), it is better to use the toolbox call InvalRect to invalidate the control area (cRect or cClip) so that it is completely erased and redrawn.
  121.  
  122. ScrCtl -1218  a,b,c,d
  123. Scrolls (or resizes, see below) content area (= cContent) of the ViewIt view or control whose ControlHandle is given by parameter a.  Parameter c is the horizontal number of pixels to scroll, and d is the vertical pixels. Positive values of c correspond to scrolling the content to the right, and negative values to the left.  Positive values of d correspond to scrolling the content down, and negative values up.  No scrolling is done if the content area in the corresponding dimension is less than or equal to the visible content area (= cClip, see "Controls" topic for definitions).
  124.   ScrCtl always scrolls the content area in multiples of 8 pixels to minimize the distortion of QuickDraw patterns, and never results in the content being scrolled completely out of view (i.e. you can pass large c or d values to scroll to an edge).  Any content area needing updating is also redrawn before returning from ScrCtl.
  125.   ScrCtl can also be used to resize the content area of views or controls. To do this, pass b = 1 to inform ViewIt that the size of the content area is being adjusted, and use c and d to define the new horizontal and vertical dimensions (pixels).  ViewIt resizes the control's content area, and, if necessary, scrolls the content back into view.
  126.   Resizing the content area is usually used by programmers who dynamically add controls to scrollable views.  In such a case, for example, the size of the content area of the view control might be adjusted to fit the number and position of daughter controls added.
  127.   NOTE:  Both hand scrolling and the ScrCtl command take advantage of ViewIt's built-in support for scrolling control contents.  This support makes use of a "content" rectangle that can be larger than the control's visible content area.  Some controls, however, ignore this scheme or use more complex, private scrolling schemes, and cannot be scrolled with ScrCtl.  A good rule to follow is that if the control can be hand scrolled, then it also supports ScrCtl.